package gao.xiaolei.controller;

import gao.xiaolei.dto.CopyJobInDto;
import gao.xiaolei.dto.JobInDtoBase;
import gao.xiaolei.dto.TaskJobInDto;
import gao.xiaolei.service.TimingService;
import org.quartz.SchedulerException;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class TimingController {

    @Resource(name = "TimingService")
    private TimingService timingService;

    @PostMapping("/testCopy")
    public void addTestCopyTimingJob(@RequestBody CopyJobInDto copyJobInDto) throws SchedulerException {
        timingService.addTestCopyTimingJob(copyJobInDto);
    }

    @PostMapping("/sendTask")
    public void addSendTaskTimingJob(@RequestBody TaskJobInDto taskJobInDto) throws SchedulerException {
        timingService.addSendTaskJob(taskJobInDto);
    }

    @PostMapping("/openClasses")
    public void addClassesOpenTimingJob(@RequestBody JobInDtoBase jobInDtoBase) throws SchedulerException {
        timingService.addClassesOpenJob(jobInDtoBase);
    }

//    @DeleteMapping("/{group}/{key}")
//    public void deleteJobByKey(@PathVariable("group") String group,
//                               @PathVariable("key") String key) throws SchedulerException {
//        timingService.cancelJob(key, group);
//    }

//    @DeleteMapping("/{group}")
//    public void deleteByGroup(@PathVariable("group") String group) throws SchedulerException {
//        timingService.cancelJobByGroup(group);
//    }

}
